/******************************************************************************
 * 
 * Announce: CSharpKit, Basic algorithms, components and definitions.
 *           Copyright (C) ShenYongchen.
 *           All rights reserved.
 *   Author: 申永辰.郑州 (shenyczz@163.com)
 *  WebSite: http://github.com/shenyczz/CSharpKit
 *
 * THIS CODE IS LICENSED UNDER THE MIT LICENSE (MIT).
 * THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 
 * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
 * IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
 * PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
 * 
******************************************************************************/
using System;
using System.Collections.Generic;

namespace CSharpKit.Numerics.LinearRegression
{
    // _lr_extensions
    internal static class Util
    {
        /// <summary>
        /// 单向解包
        /// </summary>
        /// <typeparam name="U"></typeparam>
        /// <typeparam name="V"></typeparam>
        /// <param name="samples"></param>
        /// <returns></returns>
        public static Tuple<U[], V[]> UnpackSinglePass<U, V>(this IEnumerable<Tuple<U, V>> samples)
        {
            var us = new List<U>();
            var vs = new List<V>();

            foreach (var tuple in samples)
            {
                us.Add(tuple.Item1);
                vs.Add(tuple.Item2);
            }

            return new Tuple<U[], V[]>(us.ToArray(), vs.ToArray());
        }


    }














}
